const fs = require("fs");

//先读后写(有异常catch)
let data = fs.readFileSync('./a.txt','utf8')
console.log(data);
//写入到b.txt
fs.writeFileSync('./b.txt',data);